package be.technofutur.web;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class LottoInit 
{
    public LottoInit()
    {

    }
    
    public List<Integer> randomizeSelections()
    {
       	final int MIN = 12;
    	final int MAX = 42;
    	final List<Integer> allPossible = new ArrayList<Integer>(MAX - MIN + 1);
    	for (int i = MIN; i <= MAX; ++i) 
    	{
    	    allPossible.add(i);
    	}
    	Collections.shuffle(allPossible);
    	final List<Integer> lotto = allPossible.subList(0, 6);
    	return lotto;
    }
    
    public int[] toIntArray(List<Integer> list)
    {
    	int[] lottoArray = new int[list.size()];
    	for(int i = 0;i < lottoArray.length;i++)
    	{
    		lottoArray[i] = list.get(i);
    	}
    	Arrays.sort(lottoArray);
    	return lottoArray;
   	}
}
